﻿using System.Windows.Controls;
using Microsoft.Phone.Controls;

namespace TemperatureWP.Views
{
    public partial class TargetTemperatureView : PhoneApplicationPage
    {
        private string _textBoxString;

        public TargetTemperatureView()
        {
            InitializeComponent();
        }

        private void TextBox_GotFocus(object sender, System.Windows.RoutedEventArgs e)
        {
            var textbox = sender as TextBox;
            if (textbox == null)
                return;

            _textBoxString = textbox.Text;
            textbox.Text = string.Empty;
        }

        private void TextBox_LostFocus(object sender, System.Windows.RoutedEventArgs e)
        {
            var textbox = sender as TextBox;
            if (textbox == null)
                return;

            if (string.IsNullOrEmpty(textbox.Text))
                textbox.Text = _textBoxString;
        }
    }
}